package com.dchh.android.suverynew.http;


public class ResponseResult{

    private static final long serialVersionUID = -8629182735911920398L;

    private Integer return_code;
    private Object data;
    private String return_message;

    public Integer getReturn_code() {
        return return_code;
    }

    public void setReturn_code(Integer return_code) {
        this.return_code = return_code;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public String getReturn_message() {
        return return_message;
    }

    public void setReturn_message(String return_message) {
        this.return_message = return_message;
    }

    public void checkIsSuccess() throws ResponseResultException {
        if (getReturn_code() != null) {
            if (getReturn_code() != ResponseStateEnum.Success.getCode()) {
                throw new ResponseResultException(ResponseStateEnum.fromCode(getReturn_code()), getReturn_message(), data);
            }
        } else {
            throw new ResponseResultException(getReturn_message(), data);
        }
    }
}
